package com.java.threaddemo1;

public class TestDriver {

	public static void main(String[] args) {
		test02();
	}

	/**
	 * 继承实现多线程
	 */
	private static void test01() {
		// 创建MyThread1类的实例对象
		MyThread1 t1 = new MyThread1("mythread1");
		// 创建MyThread1类的实例对象
		MyThread1 t2 = new MyThread1("mythread2");

		t1.start();
		t2.start();

	}

	/**
	 * 继承实现多线程
	 */
	private static void test02() {
		// 利用继承Thread1来创建一个线程
		MyThread1 t1 = new MyThread1("mythread1");
		// 利用接口Runnable来创建一个线程
		Runnable r = new MyThread2();
		Thread t2 = new Thread(r);
		// 开始线程
		t1.start();
		t2.start();

	}
}
